{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "fb25062a",
   "metadata": {},
   "source": [
    "------\n",
    "* 2022/9/5  / week03\n",
    "* Python学习记录\n",
    "------\n",
    "\n",
    " \n",
    " ## 本周学习目标\n",
    " > 1. 模块\n",
    " \n",
    " > 2. 变量\n",
    " \n",
    " > 3. 循环变量\n",
    " \n",
    " ## 1. 1模块（标准库）\n",
    " > Python创始人团队为后面使用这门编程语言的人们提供的解决日常生活可能使用到的功能，而制作的可以方便使用的模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "df9c3aea",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "a7fb4e87",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1662345838.8538468"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 纪元(从1970.1.1)\n",
    "# 时间戳\n",
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "6acce0cf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=5, tm_hour=10, tm_min=47, tm_sec=6, tm_wday=0, tm_yday=248, tm_isdst=0)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "193ee9fd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=5, tm_hour=2, tm_min=48, tm_sec=34, tm_wday=0, tm_yday=248, tm_isdst=0)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.gmtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "d26d0a34",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Mon Sep  5 10:58:35 2022'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.asctime(time.localtime())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c0642aa2",
   "metadata": {},
   "source": [
    "## 1.2 模块（开源模块）\n",
    "> 1. 因为代码开源\n",
    "> 2. 集合全领域(人类)的需求\n",
    "> 3. 按照国际标准开放的标准库"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4cef1d5e",
   "metadata": {},
   "source": [
    "## 1.3 模块（自定义模块）\n",
    "> 1. 不愿意开源的有一定知识产权的（开放API租用形式开放的）\n",
    "\n",
    "> 2. 自己用的，写的也不怎么好"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e301e50f",
   "metadata": {},
   "source": [
    "# 2. 变量\n",
    "\n",
    "> 1. 声明变量（明名）规则\n",
    ">> 1. 变量名只能是 字母、数字或下划线的任意组合\n",
    ">> 2. 变量名的第一个字符不能是数字\n",
    ">> 3. 以下关键字不能声明为变量名['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda','not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']   在jupyter 中显示绿色的不能命名"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "00d0f186",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三_01 = \"xiao hong\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "b4af794d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'xiao hong'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网三_01"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "aa826a56",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2780567935728"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id(网三_01)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "87699620",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "xioa hong xioa hong\n",
      "ALEX xioa hong\n"
     ]
    }
   ],
   "source": [
    "# 案例（关于变量）\n",
    "网三_01_name = \"xioa hong\"\n",
    "网三_02_name = 网三_01_name \n",
    "\n",
    "print(网三_01_name,网三_02_name)\n",
    "网三_01_name = \"ALEX\"\n",
    "print(网三_01_name,网三_02_name)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "16f475c7",
   "metadata": {},
   "source": [
    "# 课后作业\n",
    "1. 课本p4项目练习（写一遍运行成功）\n",
    "2. 思考if是什么？\n",
    "3. 思考from是什么？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "370f8d6c",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
